<template>
    <div>
        <router-view/>
        Add
        <el-input placeholder="请输入title" v-model="title"/>
        <el-input placeholder="请输入内容" v-model="content"/>
        <el-button type="primary" @click="add">添加</el-button>

    </div>
</template>

<script>
    import store from '@/store.js'
    export default {
        name: "Add",
        store,
        data() {
            return {
                title: '',
                content: ''
            }
        },
        methods: {
            add() {
                store.commit('addItem', {
                    title: this.title,
                    content: this.content
                })
                this.title="";
                this.content="";
                this.$router.push('home/list')
            }
        }
    }
</script>

<style scoped>

</style>